package com.itheima.prize.commons.db.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.prize.commons.db.entity.CardGame;
import com.itheima.prize.commons.db.service.CardGameService;
import com.itheima.prize.commons.db.mapper.CardGameMapper;
import com.itheima.prize.commons.utils.ApiResult;
import com.itheima.prize.commons.utils.PageBean;
import org.springframework.stereotype.Service;

/**
* @author shawn
* @description 针对表【card_game】的数据库操作Service实现
* @createDate 2023-12-26 11:58:48
*/
@Service
public class CardGameServiceImpl extends ServiceImpl<CardGameMapper, CardGame>
    implements CardGameService{

    /**
     * 获取活动列表
     * @param status
     * @param curpage
     * @param limit
     * @return
     */
    @Override
    public ApiResult getGameList(int status, int curpage, int limit) {
        Page page = new Page(curpage,limit);
        Page result = this.page(page);
        PageBean pageBean = new PageBean<>(result);
        return new ApiResult(1,"成功",pageBean);
    }

    /**
     * 获取活动信息
     * @param gameid
     * @return
     */
    @Override
    public ApiResult<CardGame> gameInfo(int gameid) {
        CardGame cardGame = this.getById(gameid);

        return new ApiResult<CardGame>(1,"成功",cardGame);
    }
}




